<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <!-- ECharts单文件引入 -->
    <script src="js/lib/echarts-2.2.7/echarts.js"></script>
    <script type="text/javascript">
        // 路径配置
        require.config({
            paths: {
                echarts: 'js/lib/echarts-2.2.7'
            }
        });

        function QueryString(url) {
            if (!(this instanceof QueryString)) {
                return new QueryString(url)
            }
            this.init(url);
        };
        QueryString.prototype = {
            init: function(url) {
                url || (url = location.search);
                var queryStr = url.substr(url.indexOf("?") + 1);
                this._init_queryStr(queryStr);
            },
            _init_queryStr: function(queryStr) {
                var queryList = queryStr.split("&");
                var queryHash = {};
                for (var i = 0, queryInfo, len = queryList.length; i < len; i += 1) {
                    if (queryInfo = queryList[i]) {
                        queryInfo = queryInfo.split("=");
                        if (queryInfo[1]) {
                            queryHash[queryInfo[0]] = decodeURIComponent(queryInfo[1]);
                        }
                    }
                }
                this.queryHash = queryHash;
            },
            get: function(key) {
                var queryHash = this.queryHash || {};
                return queryHash[key];
            },
            set: function(key, value) {
                var queryHash = this.queryHash || (this.queryHash = {});
                queryHash[key] = value;
            },
            toString: function(origin) {
                origin || (origin = location.origin);
                var queryHash = this.queryHash || {};
                var queryStr = "";
                for (var key in queryHash) {
                    if (queryHash.hasOwnProperty(key)) {
                        queryStr += (key + "=" + encodeURIComponent(queryHash[key])) + "&";
                    }
                }
                queryStr = queryStr.substr(0, queryStr.length - 1);
                queryStr = queryStr && ("?" + queryStr);
                var url = origin + queryStr;
                return url;
            }
        };

    </script>
    <script src="js/lib/messenger.js"></script>
    <script>
function globalEval(code) {
    if (code && /\S/.test(code)) {
        if (window.execScript) {
            window.execScript(code)
        } else {
            var head = document.head;
            var script = document.createElement('script');
            script.type = 'text/javascript';
            script.text = code;
            head.removeChild(head.appendChild(script));
        }
    }
};

var messenger = new Messenger('echarts-base-iframe', QueryString().get("project_name")||'ECharts-Run-Code');

var _RUN_SCRIPT_PREFIX_ = "RUN_SCRIPT";
messenger.listen(function(msg){
    if (msg.indexOf(_RUN_SCRIPT_PREFIX_)===0) {
    	var code = msg.substr(_RUN_SCRIPT_PREFIX_.length);
    	setTimeout(function(){
	    	globalEval(code);
    	},0)
    }else{
    	alert("ECharts Error: 错误指令");
    }
});
    </script>
    <title>ECharts</title>
    <style type="text/css">
html,body,#main{
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
}
    </style>
</head>
<body>
    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main"></div>
    <!--<script>
   require(
   	[
   		'echarts',
   		'echarts/chart/tree' // 使用柱状图就加载bar模块，按需加载
   	],
   	function(ec) {
   		// 基于准备好的dom，初始化echarts图表
   		var myChart = ec.init(document.getElementById('main'));

   		var option = {
    title : {
        text: '冰桶挑战'
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    series : [
        {
            name:'树图',
            type:'tree',
            orient: 'horizontal',  // vertical horizontal
            rootLocation: {x: 100,y: 230}, // 根节点位置  {x: 100, y: 'center'}
            nodePadding: 8,
            layerPadding: 200,
            hoverable: false,
            roam: true,
            symbolSize: 6,
            itemStyle: {
                normal: {
                    color: '#4883b4',
                    label: {
                        show: true,
                        position: 'right',
                        formatter: "{b}",
                        textStyle: {
                            color: '#000',
                            fontSize: 5
                        }
                    },
                    lineStyle: {
                        color: '#ccc',
                        type: 'curve' // 'curve'|'broken'|'solid'|'dotted'|'dashed'

                    }
                },
                emphasis: {
                    color: '#4883b4',
                    label: {
                        show: false
                    },
                    borderWidth: 0
                }
            },
            
            data: [{"name":"商品二进制分享关系网","children":[{"name":"U_f3d450df147b61b72b6","children":[]},{"name":"U_0e031ed614e7dbc45f8","children":[]},{"name":"U_d51d3e7b14a52806cbc","children":[]},{"name":"U_2b4c1f2b14e47e690e8","children":[]},{"name":"U_0b79082c14e32d98c48","children":[]},{"name":"U_f57cd9be14c2724087b","children":[]},{"name":"U_cd532b7b14e8a8f3b38","children":[]},{"name":"U_a21d0e7514e864ac3d2","children":[]},{"name":"U_62724b7a14e865fdb74","children":[]},{"name":"U_b1f4a6b714c7fbd5eb3","children":[]},{"name":"U_fda33b2149c14aee19","children":[]},{"name":"U_cd9cc5bd14e90f6a126","children":[]},{"name":"U_4b3c5ba314e913b04d1","children":[]},{"name":"U_c54c2f28148266dba0b","children":[]},{"name":"U_100eaded14e9682b863","children":[]},{"name":"U_f7d61f8814e81db5409","children":[]},{"name":"U_fd2d00e114e81f3d604","children":[]},{"name":"U_d8147e7314e66e36a2a","children":[]},{"name":"U_1b9d8c9614ddc4d5ee9","children":[]},{"name":"U_9992c77c14e48d95da8","children":[]},{"name":"U_e9d5ec1214ea125dd55","children":[]},{"name":"U_84e0c9a414eafd9352e","children":[]},{"name":"U_485499c914eaf81ea5e","children":[]},{"name":"U_a25f593614e81f24818","children":[]},{"name":"U_465a2ede14e5882dff9","children":[]},{"name":"U_ee28c3cb14eba48536c","children":[]},{"name":"U_75011c7414a0169713d","children":[]},{"name":"U_6d707d3214ebe2a2a4b","children":[]},{"name":"U_aab1c22114e7280cb50","children":[]},{"name":"U_e8ed23d14e9a1cd40e","children":[]},{"name":"U_35568b7914ec9a266fe","children":[]},{"name":"U_03ea5daf14ebf11ff3c","children":[]},{"name":"U_6cbdc4d914a588c9ce6","children":[]},{"name":"U_f6ca0f214e9a6adda4","children":[]}]}]
        }
    ]
};

   		// 为echarts对象加载数据 
   		myChart.setOption(option);
   	}
   );
    </script>-->
</body>
<script>
(function() {
    var _code = window.arguments && window.arguments[0];
    if (_code && _code.indexOf(_RUN_SCRIPT_PREFIX_) === 0) {
        var code = _code.substr(_RUN_SCRIPT_PREFIX_.length);
        setTimeout(function() {
            globalEval(code);
        }, 0)
    }


    if (window.opener||window.parent) {
        messenger.addTarget(window.opener||window.parent, "Parent");
        messenger.send("WINDOW-ONLOAD");
    }
}());
</script>